<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('餐饮企业列表')" />	
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
		  <div class="col-sm-12 search-collapse">
				<form id="role-form">
					<div class="select-list">
						<ul>
							<li>
								餐饮企业名称：<input type="text" name="name"/>
							</li>
							<li>
								店名：<input type="text" name="sign"/>
							</li>
							
							<li>
								餐厅类型：<input type="text" name="type"/>
							</li>
														
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
			<div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="add()" >
	                <i class="fa fa-plus"></i> 新增
	            </a>
	            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" >
		            <i class="fa fa-edit"></i> 修改
		        </a>
				<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" >
		            <i class="fa fa-remove"></i> 删除
		        </a>
		        
	        </div>
			        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
		
		var prefix = ctx + "enterprise";
	
		$(function() {
		    var options = {
		        url: prefix + "/list",
		        updateUrl: prefix + "/update/{id}",
		        removeUrl: prefix + "/delete",
		        sortName: "enterpriseId",
		        sortOrder: "desc",
		        modalName: "餐饮企业",
		       // stickyHeader: true,
		        //fixedColumns: true,
                //fixedNumber: 2,
                //width: $("#bootstrap-table").getFixedColumnsWidth(),
    	        //height: $("#bootstrap-table").outerHeight(true) + $("#bootstrap-table").outerHeight(true)-20,
    	       // height: $("#bootstrap-table").bootstrapTable('resetView', { height: $(window).height()}),
    	        //width: $("#bootstrap-table").bootstrapTable('resetView', { width: $(window).width()}),
		            
		        columns: [{
		            checkbox: true
		        },
		        {
		            field: 'enterpriseId',
		            title: '餐饮企业id',
		            visible: false
		        },
		        {
		            field: 'name',
		            title: '餐饮企业名称'
		        },
		        {
		            field: 'sign',
		            title: '店名',
		            sortable: true
		        },
		        {
		            field: 'workerNum',
		            title: '从业人数',
		            sortable: true
		        },
		        {
		            field: 'type',
		            title: '餐饮企业类型',
		            sortable: true
		        },
		        {
		            field: 'address',
		            title: '地址',
		            sortable: true
		        },
		        {
		            field: 'intro',
		            title: '介绍',
		            sortable: true,
		            visible: false
		        },
		        {
		            field: 'fzrName',
		            title: '负责人',
		            sortable: true
		        },
		        {
		            field: 'fzrTel',
		            title: '负责人电话',
		            sortable: true
		        },
		        {
		            field: 'area',
		            title: '营业面积',
		            sortable: true
		        },
		        {
		            field: 'capacity',
		            title: '可容纳人数',
		            sortable: true
		        },
		        {
		            field: 'isWaterPoint',
		            title: '是否设置已取水地点',
		            sortable: true,
		            formatter: function (value, row, index) {
		        		if(value=="1"){
		        			return "是";
		        		}else if(value=="0"){
		        			return "否"
		        		}
		        	}
		        },
		        {
		            field: 'signupSafe',
		            title: '报名放心餐饮',
		            sortable: true,
		            formatter: function (value, row, index) {
		        		if(value=="1"){
		        			return "已报名";
		        		}else if(value=="0"){
		        			return "未报名"
		        		}
		        	}
		        },
		        {
		            field: 'isSafe',
		            title: '是否放心餐饮',
		            sortable: true,
		            formatter: function (value, row, index) {
		        		if(value=="1"){
		        			return "是";
		        		}else if(value=="0"){
		        			return "否"
		        		}
		        	}
		        },
		        {
		            field: 'safeYear',
		            title: '放心餐饮年度',
		            sortable: true
		        },
		        {
		            field: 'stockNum',
		            title: '库存滴水山泉数',
		            sortable: true
		        },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                var actions = [];
		                actions.push('<a class="btn btn-primary btn-xs ' +  '" href="javascript:void(0)" onclick="upload(\'' + row.enterpriseId + '\')"><i class="fa fa-check-square-o"></i>上传</a> ');
		                actions.push('<a class="btn btn-primary btn-xs ' +  '" href="javascript:void(0)" onclick="look(\'' + row.enterpriseId + '\')"><i class="fa fa-check-square-o"></i>附件查看</a> ');
		                return actions.join('');
		            }
		        }]
		    };
		    $.table.init(options);
		});
			
		function add(){
			 var url = 'enterprise/add';
			 $.modal.open("餐饮企业新增", url);
		};
		
		function upload(enterpriseId){
			 var url = 'enterprise/upload/'+enterpriseId;
			 $.modal.open("文件上传", url);
		};
		
		function look(enterpriseId){
			 var url = 'enterprise/look/'+enterpriseId;
			 $.modal.open("文件查看", url);
		}
		
	</script>
</body>
</html>